package com.jichangxiu.common.entity.dto;

import cn.hutool.core.util.ObjectUtil;
import com.jichangxiu.common.constant.Constants;
import com.jichangxiu.common.entity.bo.Record;
import lombok.Data;

import java.io.Serializable;

@Data
public class QueryEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    private String sourceCode;

    private Integer pageNum;

    private Integer pageSize;

    private Record params;

    public Record getParams() {
        if (ObjectUtil.isEmpty(params))
            params = Record.getRecord();
        return params;
    }

    public void setParams(Record params) {
        this.params = params;
    }

    public String getScope() {
        return getParams().getStr(Constants.DATA_SCOPE);
    }

    public String getAndScope() {
        return getParams().getStr(Constants.AND_DATA_SCOPE);
    }

}
